package com.softserveinc.ita.kaiji.model.game;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import com.softserveinc.ita.kaiji.model.player.Player;
import org.apache.log4j.Logger;

import com.softserveinc.ita.kaiji.model.player.bot.Bot.Types;

/**
 * 
 * @author Bohdan Shaposhnik
 * @version 2.1
 * @since 17.03.2014
 */
public class GameInfoImpl implements GameInfo {

	private static Logger logger = Logger.getLogger(GameInfoImpl.class);

    private String ownerName;

	private Set<Player> players = new HashSet<Player>();

	private boolean isBotGame = false;
	

 	private String gameName = null;
    
	private Integer numberOfCards = 0;
    
	private Types botType = null;

    private Date gameStartTime;

    private Date gameFinishTime;
	
	public GameInfoImpl(){}
	public GameInfoImpl(
			String gameName
			, String ownerName
			, Integer numberOfCards
			, boolean isBotGame
			, Types botType
			, Set<Player> players){
		this.gameName = gameName;
		this.ownerName = ownerName;
		this.numberOfCards = numberOfCards;
		this.isBotGame = isBotGame;
		this.players=players;
		this.botType = botType;
		if (this.isBotGame) {
			if (logger.isDebugEnabled()){
				logger.trace("GameInfoImpl: the mod is: bot VS player");}
		}
	}
	
	@Override
	public String getOwnerName(){
		return ownerName;
	}
	
	@Override
	public Set<Player> getPlayers() {
		return players;
	}
	
	
	// adds only humanPlayers
	
	@Override
	public boolean isBotGame() {
		return isBotGame;
	}
	
	public void setBotGame(boolean isBotGame) {
		this.isBotGame = isBotGame;
	}

	@Override
	public String getGameName() {
		return gameName;
	}
	
	public void setGameName(String gameName) {
		this.gameName = gameName;
	}	

	@Override
	public Integer getNumberOfCards() {
		return numberOfCards;
	}
	
	public void setNumberOfCards(int numberOfCards) {
		this.numberOfCards = numberOfCards;
	}

	@Override
	public Types getBotType() {
		return botType;
	}

    @Override
    public Date getGameStartTime() {
        return gameStartTime;
    }

    @Override
    public void setGameStartTime(Date gameStartTime) {
        this.gameStartTime = gameStartTime;
    }

    @Override
    public Date getGameFinishTime() {
        return gameFinishTime;
    }

    @Override
    public void setGameFinishTime(Date gameFinishTime) {
        this.gameFinishTime = gameFinishTime;
    }

    public void setBotType(Types botType) {
		this.botType = botType;
	}

}
